﻿using CinemaMaestro.DataLayer.Contracts.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CinemaMaestro.ViewModels
{
    public class DirectorViewModel
    {
        public int Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public DateTime BirthDay { get; set; }
        public byte[] Image { get; set; }        

        public static implicit operator DirectorViewModel(Director director)
        {
            return new DirectorViewModel
            {
                Id = director.Id,
                FirstName = director.FirstName,
                LastName = director.LastName,
                BirthDay = director.BirthDay,
                Image = director.Image
            };
        }

        public static implicit operator Director(DirectorViewModel directorVM)
        {
            return new Director
            {
                Id = directorVM.Id,
                FirstName = directorVM.FirstName,
                LastName = directorVM.LastName,
                BirthDay = directorVM.BirthDay,
                Image = directorVM.Image
            };
        }

        public override string ToString()
        {
            return FirstName + " " + LastName;
        }

    }
}
